<?php
/**
 * Description of MessageFacade
 *
 * @author TheFaSTeR
 */
class MessageFacade
{
    
    public static function getUserInboxMails($userId)
    {
        return Message::model()->time()->findAll('to_user=:user', array(':user' => $userId));        
    }
    
    public static function getUserOutboxMails($userId)
    {
        return Message::model()->time()->findAll('from_user=:user', array(':user' => $userId));        
    }
    
    public static function getMessageByPk($id)
    {
        return Message::model()->findByPk($id);
    }
    
    public static function getAllMessagesByUser($userId)
    {
        return Message::model()->time()->findAll('from_user=:user OR to_user=:user', array(':user' => $userId));
    }

}
